﻿
Partial Class Dente
    Inherits System.Web.UI.UserControl

    Public Enum Cor
        blue
        red
        yellow
        white
    End Enum
    Public Property Posicao01_Cor As Cor
        Set(value As Cor)
            posicao01.BgColor = value.ToString
        End Set
        Get
            If posicao01.BgColor = "blue" Then
                Return Cor.blue
            ElseIf posicao01.BgColor = "red" Then
                Return Cor.red
            ElseIf posicao01.BgColor = "yellow" Then
                Return Cor.yellow
            Else
                Return Cor.white
            End If
        End Get
    End Property
    Public Property Posicao02_Cor As Cor
        Set(value As Cor)
            posicao02.BgColor = value.ToString
        End Set
        Get
            If posicao02.BgColor = "blue" Then
                Return Cor.blue
            ElseIf posicao02.BgColor = "red" Then
                Return Cor.red
            ElseIf posicao02.BgColor = "yellow" Then
                Return Cor.yellow
            Else
                Return Cor.white
            End If
        End Get
    End Property
    Public Property Posicao03_Cor As Cor
        Set(value As Cor)
            posicao03.BgColor = value.ToString
        End Set
        Get
            If posicao03.BgColor = "blue" Then
                Return Cor.blue
            ElseIf posicao03.BgColor = "red" Then
                Return Cor.red
            ElseIf posicao03.BgColor = "yellow" Then
                Return Cor.yellow
            Else
                Return Cor.white
            End If
        End Get
    End Property
    Public Property Posicao04_Cor As Cor
        Set(value As Cor)
            posicao04.BgColor = value.ToString
        End Set
        Get
            If posicao04.BgColor = "blue" Then
                Return Cor.blue
            ElseIf posicao04.BgColor = "red" Then
                Return Cor.red
            ElseIf posicao04.BgColor = "yellow" Then
                Return Cor.yellow
            Else
                Return Cor.white
            End If
        End Get
    End Property
    Public Property Posicao05_Cor As Cor
        Set(value As Cor)
            posicao05.BgColor = value.ToString
        End Set
        Get
            If posicao05.BgColor = "blue" Then
                Return Cor.blue
            ElseIf posicao05.BgColor = "red" Then
                Return Cor.red
            ElseIf posicao05.BgColor = "yellow" Then
                Return Cor.yellow
            Else
                Return Cor.white
            End If
        End Get
    End Property
    Public Property DenteExtraido As Boolean
        Set(value As Boolean)
            If value Then
                PnlDenteExtraido.Visible = True
                PnlDenteNormal.Visible = False
            Else
                PnlDenteExtraido.Visible = False
                PnlDenteNormal.Visible = True
            End If
        End Set
        Get
            Return False
        End Get
    End Property

    Public Property NumeroDente As Integer
        Set(value As Integer)
            LnkNumero.Text = value
        End Set
        Get
            Return LnkNumero.Text
        End Get
    End Property




    Private AllEvents As New System.ComponentModel.EventHandlerList


    Public Custom Event SelecionaNumero As EventHandler
        AddHandler(ByVal value As EventHandler)
            AllEvents.AddHandler("SelecionaNumero", value)
        End AddHandler

        RemoveHandler(ByVal value As EventHandler)
            AllEvents.RemoveHandler("SelecionaNumero", value)
        End RemoveHandler

        RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim value As EventHandler = CType(AllEvents("SelecionaNumero"), EventHandler)
            If Not value Is Nothing Then
                value.Invoke(sender, e)
            End If
        End RaiseEvent
    End Event
    Protected Sub LnkNumero_Click(sender As Object, e As EventArgs) Handles LnkNumero.Click
        RaiseEvent SelecionaNumero(sender, e)
    End Sub


    Public Custom Event Cor01 As EventHandler
        AddHandler(ByVal value As EventHandler)
            AllEvents.AddHandler("Cor01", value)
        End AddHandler

        RemoveHandler(ByVal value As EventHandler)
            AllEvents.RemoveHandler("Cor01", value)
        End RemoveHandler

        RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim value As EventHandler = CType(AllEvents("Cor01"), EventHandler)
            If Not value Is Nothing Then
                value.Invoke(sender, e)
            End If
        End RaiseEvent
    End Event
    Public Custom Event Cor02 As EventHandler
        AddHandler(ByVal value As EventHandler)
            AllEvents.AddHandler("Cor02", value)
        End AddHandler

        RemoveHandler(ByVal value As EventHandler)
            AllEvents.RemoveHandler("Cor02", value)
        End RemoveHandler

        RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim value As EventHandler = CType(AllEvents("Cor02"), EventHandler)
            If Not value Is Nothing Then
                value.Invoke(sender, e)
            End If
        End RaiseEvent
    End Event
    Public Custom Event Cor03 As EventHandler
        AddHandler(ByVal value As EventHandler)
            AllEvents.AddHandler("Cor03", value)
        End AddHandler

        RemoveHandler(ByVal value As EventHandler)
            AllEvents.RemoveHandler("Cor03", value)
        End RemoveHandler

        RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim value As EventHandler = CType(AllEvents("Cor03"), EventHandler)
            If Not value Is Nothing Then
                value.Invoke(sender, e)
            End If
        End RaiseEvent
    End Event
    Public Custom Event Cor04 As EventHandler
        AddHandler(ByVal value As EventHandler)
            AllEvents.AddHandler("Cor04", value)
        End AddHandler

        RemoveHandler(ByVal value As EventHandler)
            AllEvents.RemoveHandler("Cor04", value)
        End RemoveHandler

        RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim value As EventHandler = CType(AllEvents("Cor04"), EventHandler)
            If Not value Is Nothing Then
                value.Invoke(sender, e)
            End If
        End RaiseEvent
    End Event
    Public Custom Event Cor05 As EventHandler
        AddHandler(ByVal value As EventHandler)
            AllEvents.AddHandler("Cor05", value)
        End AddHandler

        RemoveHandler(ByVal value As EventHandler)
            AllEvents.RemoveHandler("Cor05", value)
        End RemoveHandler

        RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim value As EventHandler = CType(AllEvents("Cor05"), EventHandler)
            If Not value Is Nothing Then
                value.Invoke(sender, e)
            End If
        End RaiseEvent
    End Event
    Protected Sub LnkBtnPosicao_01_Click(sender As Object, e As EventArgs) Handles LnkBtnPosicao_01.Click
        RaiseEvent Cor01(sender, e)
    End Sub

    Protected Sub LnkBtnPosicao_02_Click(sender As Object, e As EventArgs) Handles LnkBtnPosicao_02.Click
        RaiseEvent Cor02(sender, e)
    End Sub

    Protected Sub LnkBtnPosicao_03_Click(sender As Object, e As EventArgs) Handles LnkBtnPosicao_03.Click
        RaiseEvent Cor03(sender, e)
    End Sub

    Protected Sub LnkBtnPosicao_04_Click(sender As Object, e As EventArgs) Handles LnkBtnPosicao_04.Click
        RaiseEvent Cor04(sender, e)
    End Sub

    Protected Sub LnkBtnPosicao_05_Click(sender As Object, e As EventArgs) Handles LnkBtnPosicao_05.Click
        RaiseEvent Cor05(sender, e)
    End Sub
End Class
